package com.qh.yyxt.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.qh.yyxt.entity.BorrowThing;
import com.qh.yyxt.entity.GetAndReturn;
import com.qh.yyxt.pojo.entity.thing.Thing;
import com.qh.yyxt.pojo.entity.thing.ThingSize;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonForMe
{
    //thing 部分
    //thing 部分
    @JsonProperty("id")
    private String id;
    @JsonProperty("name")
    private String name;
    @JsonProperty("num")
    private Integer num;
    //剩余数量
    @JsonProperty("renum")
    private Integer renum;
    //基本单位
    @JsonProperty("unit")
    private String unit;
    //照片
    @JsonProperty("image")
    private  String image;
    //值班人员审批的数量
    @JsonProperty("approve1")
    private Integer approve1;
    @JsonProperty("sign")
    private String sign;
    //老师
    @JsonProperty("approve2")
    private Integer approve2;
    private List<ThingSize> thingSizeList=new ArrayList<>();
    public Thing getThing(){
        Thing thing=new Thing();
        if(this.id!=null)
        {Integer id=Integer.parseInt(this.id);
        thing.setId(id);}
        thing.setName(name);
        thing.setNum(num);
        thing.setRenum(renum);
        thing.setUnit(unit);
        thing.setImage(image);
        thing.setApprove1(approve1);
        thing.setApprove2(approve2);
        thing.setSign(sign);
        return thing;
    }
    public List<ThingSize>getThingSizeList(){
        return thingSizeList;
    }
    // List<BorrowThing>list
    private  List<BorrowThing>borrowThingList=new ArrayList<>();
    public  List<BorrowThing>getBorrowThingList(){
        return borrowThingList;
    }
    //GetAndReturn
    @JsonProperty("fid")
    private Integer fid;
    @JsonProperty("gname")
    private String gname;
    @JsonProperty("gtel")
    private String gtel;
    @JsonProperty("gwatch")
    private String gwatch;
    @JsonProperty("gmes")
    private String gmes;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date gtime;
    @JsonProperty("rname")
    private String rname;
    @JsonProperty("rtel")
    private String rtel;
    @JsonProperty("rwatch")
    private String rwatch;
    @JsonProperty("rmes")
    private String rmes;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date rtime;
    public GetAndReturn getGetAndReturn()
    {
        GetAndReturn getAndReturn=new GetAndReturn();
        getAndReturn.setFid(fid);
        getAndReturn.setGname(gname);
        getAndReturn.setGtel(gtel);
        getAndReturn.setGwatch(gwatch);
        getAndReturn.setGmes(gmes);
        getAndReturn.setGtime(gtime);
        getAndReturn.setRname(rname);
        getAndReturn.setRtel(rtel);
        getAndReturn.setRwatch(rwatch);
        getAndReturn.setRmes(rmes);
        getAndReturn.setRtime(rtime);
        return  getAndReturn;
    }

}
